﻿<cfsilent>
	<cfscript>

		event.setArg("pageTitle", "教师档案");

		currentTab = event.getArg("TabID", "labWelcome");

		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");

		/* 教师相关信息 */
		teacherId = sessionAdvice.getAutherUserID();
		
		/* 账户信息 */
		sql = "SELECT user_email FROM t_user WHERE user_id = :teacherId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

		rs_user = queryObj.execute( sql=sql ).getResult();
		
		
		/* 教师信息 */
		sql = "SELECT 
				tch_id, tch_idcard, tch_name, tch_sex, tch_tel, 
				t_institute.institute_name, 
				t_technical_position.tp_series, t_technical_position.tp_rank, 
				t_teacher_educational.edu_background
				FROM t_teacher 
				INNER JOIN t_institute ON t_institute.institute_id = t_teacher.institute_id 
				INNER JOIN t_technical_position ON t_technical_position.tp_id = t_teacher.tp_id 
				INNER JOIN t_teacher_educational ON t_teacher_educational.edu_id = t_teacher.edu_id 
				WHERE tch_id = :teacherId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

		rs_teacher = queryObj.execute( sql=sql ).getResult();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>教师个人信息
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="welcome">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labWelcome">class="active"</cfif> id="labWelcome" tabTarget="Welcome">注册信息</span>
						<span <cfif currentTab eq "labModify">class="active"</cfif> id="labModify" tabTarget="Modify">修改教师档案</span>
                              <span <cfif currentTab eq "labPicture">class="active"</cfif> id="labPicture" tabTarget="Picture">照片</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					
					// -->
					//]]>
				</script>
				
				<div id="Welcome" class="tabContent">
				
					<div class="noticeBlock">
						<h3>教职工基础信息</h3>
						<hr/>
					</div>
					
					<table class="UItable withBorder">
						<tr>
							<td>姓名</td>
							<td><cfoutput>#rs_teacher.tch_name#</cfoutput></td>
							<td>性别</td>
							<td><cfif rs_teacher.tch_sex eq "1">男<cfelse>女</cfif></td>
							<td style="padding:0;" width="135" height="180" valign="middle" align="center" rowspan="5"><img width="135" height="180" align="middle" src="teacher/profile/<cfoutput>#rs_teacher.tch_id#</cfoutput>.jpg" /></td>
						</tr>
						<tr>
							<td>所在院（部、中心）</td>
							<td colspan="3"><cfoutput>#rs_teacher.institute_name#</cfoutput></td>
						</tr>
						<tr>
							<td>电子邮件</td>
							<td><span class="number"><cfoutput>#rs_user.user_email#</cfoutput></span></td>
							<td>联系电话</td>
							<td><span class="number"><cfoutput>#rs_teacher.tch_tel#</cfoutput></span></td>
						</tr>
					</table>
					
				</div>
				
				<div id="Modify" class="tabContent">
					
					<div class="noticeBlock">
						<h3>修改您的个人信息</h3>
						<hr/>
					</div>
					
					<form id="formBasic" onSubmit="javascript:return processVerfiyForm('formBasic');" class="formWrapper" method="post" action="<cfoutput>#buildURL('profileUpdateDo')#</cfoutput>">
						
						<div class="label">
							<span class="req">*</span><b>教师姓名</b>
							<input name="UserName" id="UserName" type="text" class="typeTextTiny inlinePart" verification="required" maxlength="15" value="<cfoutput>#event.getArg('TeacherName', rs_teacher.tch_name)#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>性别</b>
							<input name="TeacherSex" type="radio" class="typeRadio" value="1" <cfif event.getArg('TeacherSex', rs_teacher.tch_sex) eq "1">checked="checked"</cfif> />男
							<input name="TeacherSex" type="radio" class="typeRadio" value="2" <cfif event.getArg('TeacherSex', rs_teacher.tch_sex) eq "2" >checked="checked"</cfif> />女
						</div>
                              
						<input name="TeacherIDCard" id="TeacherIDCard" type="hidden" class="typeIDCard inlinePart" maxlength="18" value="<cfoutput>#event.getArg('TeacherIDCard', rs_teacher.tch_idcard)#</cfoutput>" />
                              
						<!---<div class="label">
							<span class="req">*</span><b>身份证号</b>
							<input name="TeacherIDCard" id="TeacherIDCard" type="text" class="typeIDCard inlinePart" maxlength="18" value="<cfoutput>#event.getArg('TeacherIDCard', rs_teacher.tch_idcard)#</cfoutput>" />
							<p class="notice">教师个人证件号码, 系统默认会设定一个，可以不修改</p>
						</div>--->
						
						<hr/>
						
						<div class="label">
							<b>电子邮件</b>
							<input name="EmailAddress" id="EmailAddress" type="text" class="typeEnglish" verification="email" maxlength="120" value="<cfoutput>#event.getArg('EmailAddress', rs_user.user_email)#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>联系电话</b>
							<input name="TeacherTelephone" id="TeacherTelephone" type="text" class="typeEnglish" maxlength="16" value="<cfoutput>#event.getArg('TeacherTelephone', rs_teacher.tch_tel)#</cfoutput>" />
						</div>
                              
                              <hr/>
						<div class="label">
                              <p class="notice">如果不修改密码，请留空</p>
							<b>用户密码</b>
							<input name="password" id="password" type="password"  verification="password" class="typeEnglish" maxlength="16" value="" />
						</div>
                              <div class="label">
							<b>密码确认</b>
							<input name="password2" id="password2" type="password"  verification="password" class="typeEnglish" maxlength="16" value="" />
						</div>
                              
						<div class="lable">
							<input class="button" type="submit" value="更新" />
						</div>
						
					</form>
					
				</div>
                    
                    
                    <div id="Picture" class="tabContent">
					<div class="noticeBlock">
						<h3>电子照片</h3>
						<hr/>
					</div>
					
					<div class="mbl">
						<img class="img_border" width="240" height="320" src="teacher/print/<cfoutput>#rs_teacher.tch_id#</cfoutput>.jpg" />
					</div>

					<form target="output" id="formPic" onSubmit="javascript:return processVerfiyForm('formPic');" class="formWrapper" method="post" enctype="multipart/form-data" action="<cfoutput>#buildURL('uploadTeacherPicDo')#</cfoutput>">
						<input type="hidden" name="teacherId" value="<cfoutput>#teacherId#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>更新照片</b>
							<input name="upload" id="upload" type="file" verification="required" />
							<p class="notice">请使用至少 480x640 尺寸（比例4:3）的 jpg 图片作为上传文件</p>
						</div>
						
						<div class="lable"><input id="importTrigger" class="button" type="submit" value="更新照片" /></div>
						
					</form>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
							$("#importTrigger").click(function(){
								
								if ( processVerfiyForm('formPic') ) {
									$("#output").attr("src","about:blank").removeClass("hidden_elem");
								}
								
							});
						});
						// -->
						//]]>
					</script>
					
					
					<iframe name="output" id="output" class="UIframeBox hidden_elem" src="about:blank" frameborder="0"></iframe>

				</div>
                    
				
			</div>
		</li>
	</ul>
</div>


